Example: Use the OnInterviewSessionCreatedEvent to pre-seed data into a newly created session

Example: Use the OnInterviewSessionCreatedEvent to pre-seed data into a newly created session

The most common implementation for OnInterviewSessionCreatedEvent Handlers is to pre-form additional configuration on a newly created Interview Session; for example, pre-seeding it with data before the interview commences. This example shows how to pre-seed data from values provided on the query string.

Setup

To deploy this example, do the following:

  1. Copy the rulebase .zip file (PocketMoneyComputation.zip) from examples\rulebases\compiled to the rulebase folder in Web Determinations (for example, <webroot>\WEB-INF\classes\rulebases).
  2. Install the PreSeedValues.jar file in Web Determinations (found at examples\web-determinations\preseed-values).

How the sample works

This sample works by checking query parameters of the request that starts the InterviewSession and then pre-seeds any provided values for the attributes "the person" and "the pocket money base rate". The expected query string parameters are key from the attribute's public name; that is:

Example:

If we start a session with the following URL:

http://myserver/web-determinations/startsession/PocketMoneyComputation/en-GB?person_name=Fred&base_rate=2.50

it will start an InterviewSession and pre-seed the person as Fred and the pocket money base rate as 2.50.